package cn.wanghaomiao.dao;

import java.util.List;

import org.apache.commons.lang.StringUtils;

import cn.wanghaomiao.model.Invitation;

public class InvitationDao {
	
	public static void insert(Invitation inv){
		
		List<String> ids = inv.getInvitation_id();
		List<String> titles = inv.getInvitation_title();
		List<String> contents = inv.getInvitation_content();
		List<String> lvs = inv.getAuthor_Lv();
		List<String> unames = inv.getUniversity_name();
		List<String> nums = inv.getReply_num();
		List<String> pictures = inv.getHead_picture_url();
		List<String> anames = inv.getAuthor_name();
		List<String> clients = inv.getClient();
		List<String> times = inv.getClient_time();
		
		for (int i=0;i<ids.size();i++) {
			if(StringUtils.isNotBlank(ids.get(i))){
				HBaseDao.insert("invitation", "invi", "info", "inviId",ids.get(i).toString());
			}
		}
		for (int i=0;i<titles.size();i++) {
			if(StringUtils.isNotBlank(titles.get(i))){
				HBaseDao.insert("invitation", "invi", "info", "inviTitle",titles.get(i).toString());
			}
		}
		for (int i=0;i<contents.size();i++) {
			if(StringUtils.isNotBlank(contents.get(i))){
				HBaseDao.insert("invitation", "invi", "info", "inviContent",contents.get(i).toString());
			}
		}
		for (int i=0;i<lvs.size();i++) {
			if(StringUtils.isNotBlank(lvs.get(i))){
				HBaseDao.insert("invitation", "invi", "info", "inviLv",lvs.get(i).toString());
			}
		}
		for (int i=0;i<unames.size();i++) {
			if(StringUtils.isNotBlank(unames.get(i))){
				HBaseDao.insert("invitation", "invi", "info", "univName",unames.get(i).toString());
			}
		}
		for (int i=0;i<nums.size();i++) {
			if(StringUtils.isNotBlank(nums.get(i))){
				HBaseDao.insert("invitation", "invi", "info", "inviNum",nums.get(i).toString());
			}
		}
		for (int i=0;i<pictures.size();i++) {
			if(StringUtils.isNotBlank(pictures.get(i))){
				HBaseDao.insert("invitation", "invi", "info", "inviDp",pictures.get(i).toString());
			}
		}
		for (int i=0;i<anames.size();i++) {
			if(StringUtils.isNotBlank(anames.get(i))){
				HBaseDao.insert("invitation", "invi", "info", "inviName",anames.get(i).toString());
			}
		}
		for (int i=0;i<clients.size();i++) {
			if(StringUtils.isNotBlank(clients.get(i))){
				HBaseDao.insert("invitation", "invi", "info", "inviClient",clients.get(i).toString());
			}
		}
		for (int i=0;i<times.size();i++) {
			if(StringUtils.isNotBlank(times.get(i))){
				HBaseDao.insert("invitation", "invi", "info", "inviTime",times.get(i).toString());
			}
		}
		
		
	}
}
